#include <opencv2/opencv.hpp>
#include <stdlib.h>
#include <stdio.h>

#define MIN3(x,y,z)  ((y) <= (z) ? ((x) <= (y) ? (x) : (y)) : ((x) <= (z) ? (x) : (z)))
#define MAX3(x,y,z)  ((y) >= (z) ? ((x) >= (y) ? (x) : (y)) : ((x) >= (z) ? (x) : (z)))

#define PI 3.14159

//#define VARIANT2_VALUES // last round of testing at playspace; liberal value
//#define VARIANT3_VALUES
#define VARIANT4_VALUES

#ifdef VARIANT2_VALUES
const int HUE_MIN =  60;
const int HUE_MAX =  95;
const int SAT_MIN =  20;
const int SAT_MAX = 250;
const int VAL_MIN = 100;
const int VAL_MAX = 300;
#else
#ifdef VARIANT3_VALUES
const int HUE_MIN =  40;
const int HUE_MAX =  95;
const int SAT_MIN =  3;
const int SAT_MAX = 250;
const int VAL_MIN = 100;
const int VAL_MAX = 300;
#else
#ifdef VARIANT4_VALUES
const int HUE_MIN =  60;
const int HUE_MAX =  95;
const int SAT_MIN =  220;
const int SAT_MAX = 300;
const int VAL_MIN = 100;
const int VAL_MAX = 300;
#else
// Vlad's playspace values
const int HUE_MIN =  60;
const int HUE_MAX =  90;
const int SAT_MIN =  50;
const int SAT_MAX = 200;
const int VAL_MIN = 100;
const int VAL_MAX = 300;
#endif
#endif
#endif

//Actual thresholder!
void FilterColor(cv::Mat &src);

int RectHeight(std::vector<cv::Point> coordinates);

//Calibrate focal distance of camera
double GetFocalDist(int pixSize, double objSize, double dist);

//#define SAVE_IMAGES 1
//#define SAVE_TRIGGER 1
//#define WINDOW 1
